package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflInformationCommendandtread;

@Mapper
public interface MfflInformationCommendandtreadDao {

    @Select("select * from mffl_information_commendandtread t where t.id = #{id}")
    MfflInformationCommendandtread getById(Long id);

    @Delete("delete from mffl_information_commendandtread where id = #{id}")
    int delete(Long id);

    int update(MfflInformationCommendandtread mfflInformationCommendandtread);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_information_commendandtread(user_id, reply_id, type) values(#{userId}, #{replyId}, #{type})")
    int save(MfflInformationCommendandtread mfflInformationCommendandtread);

    int count(@Param("params") Map<String, Object> params);

    List<MfflInformationCommendandtread> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    //资讯-回答-查询是否赞或踩
    @Select("select * from mffl_information_commendandtread where user_id=#{userId} and reply_id = #{replyId} and type = #{type} ")
    MfflInformationCommendandtread getCountByReplyId(@Param("userId") Long userId, @Param("replyId") Long replyId,@Param("type")String type);
}
